Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:30:37+00:00 2026-05-26T12:30:37+00:00

I want to create APN by code, is there any support in Android SDK,

  • 0

I want to create APN by code, is there any support in Android SDK, i have tried a lot but not succeed,I found some info related to this http://blogs.msdn.com/b/zhengpei/archive/2009/10/13/managing-apn-data-in-google-android.aspx i made a class using this reference but not able to do anything,can any please give the solution for this????
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:30:38+00:00Added an answer on May 26, 2026 at 12:30 pm

    I will give some examples:

    Getting default APN information:

    //path to APN table
    final Uri APN_TABLE_URI = Uri.parse("content://telephony/carriers");
    
    //path to preffered APNs
    final Uri PREFERRED_APN_URI = Uri.parse("content://telephony/carriers/preferapn");
    
    //receiving cursor to preffered APN table
    Cursor c = getContentResolver().query(PREFERRED_APN_URI, null, null, null, null);
    
    //moving the cursor to beggining of the table
    c.moveToFirst();
    
    //now the cursor points to the first preffered APN and we can get some
    //information about it
    //for example first preffered APN id    
    int index = c.getColumnIndex("_id");    //getting index of required column
    Short id = c.getShort(index);           //getting APN's id from
    
    //we can get APN name by the same way
    index = c.getColumnIndex("name");
    String name = c.getString(index); 
    
    //and any other APN properties: numeric, mcc, mnc, apn, user, server,
    //password, proxy, port, mmsproxy, mmsport, mmsc, type, current
    

    To define new APN:

    //first we have to create a new row in APN table
    int id = -1;
    ContentResolver resolver = this.getContentResolver();
    ContentValues values = new ContentValues();
    
    //create value, you can define any other APN properties in the same way
    values.put("name", "Your APN Name");    //choose APN name, like 3G Orange
    values.put("apn", "Your APN address");  //choose APN address, like cellcom.wapu.co.il
    
    //now we have to define APN setting page UI. You have to get operator numeric property
    //you can obtain it from TelephonyManager.getNetworkOperator() method
    values.put("mcc", "your operator numeric high part");  //for example 242
    values.put("mnc", "your operator numeric low part");   //for example 501
    values.put("numeric", "your operator numeric");        //for example 242501
    
    Cursor c = null;
    try
    {
        //insert new row to APN table
        Uri newRow = resolver.insert(APN_TABLE_URI, values);
        if(newRow != null)
        {
            c = resolver.query(newRow, null, null, null, null);
    
            //obtain the APN id
            int index = c.getColumnIndex("_id");
            c.moveToFirst();
            id = c.getShort(index);
        }
    }
    catch(Exception e)
    {
    }
    
    //now after we created a new APN in APN table
    //and APN's ID stored in id variable (or -1 if any troubles was happaned)
    //we can define a new APN as default
    values = new ContentValues();
    values.put("apn_id", id); 
    
    try
    {
        resolver.update(PREFERRED_APN_URI, values, null, null);
    }
    catch (Exception e)
    {
    }
    

    so, it have to work, but if it not – tell me and I will try to examine problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want create date validation but not know why return is false? $data_go =
I want create object from Canvas3D class(in java) but my Compiler doesn't have this
i want create image animation , i have 50 images with png format now
In C# code, I want create a log file for each each method in
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
say, I have a table TABLE(col1,col2,col3) and, I want create a index INDEX(col1=table.col1+table.col2)
I want create a DataSet class which is basically a list of samples. But
I want create Word document from another Word document, but I need replace some
I want create listview without layout_height. I mean if there is 100 item in
i want create XML file here is my following code String fileName = jasstech.xml;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.