New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
muziling
Old
(Last edited by muziling; 26th April 2011 at 02:12 AM.)
#1  
Senior Member - OP
Thanks Meter 32
Posts: 274
Join Date: Dec 2010
Default How to set CDMA APNs with new more stable ril

See post #20 , highlandsun resolved this.

I decide to create an new thread for APNs setting, just search for many help.
Thanks to highlandsun, the ril is great.
RIL link : http://forum.xda-developers.com/show....php?t=1009112

Android I run: **Complete GingerBread Bundle!!** GBX0A - Alpha! Camera!
Put apns-conf.xml in /system/etc, go to mobile network -> APN, menu key, reset to default, system will load the APNs from apns-conf.xml and add APNs which match your carrier's operator ID.

After enable data connection, android seems not pass selected APN's info to ril (such as APN name,user,password)
Quote:
D/RIL ( 1422): requesting data connection to APN '(null)'
APN got null value from system, then use default user/password to connect(default is dummy/dummy). So if user/password is not dummy/dummy, data connection will not work.

The new ril handled MMS, we can set the correct APNs for MMS receive.
EVO3D sprint
 
vnes1984
Old
#2  
Senior Member
Thanks Meter 2
Posts: 96
Join Date: Aug 2010
Quote:
Originally Posted by muziling View Post
I decide to create an new thread for APNs setting, just search for many help.
Thanks to highlandsun, the ril is great.
RIL link : http://forum.xda-developers.com/show....php?t=1009112

Android I run: **Complete GingerBread Bundle!!** GBX0A - Alpha! Camera!
Put apns-conf.xml in /system/etc, go to mobile network -> APN, menu key, reset to default, system will load the APNs from apns-conf.xml and add APNs which match your carrier's operator ID.

After enable data connection, android seems not pass selected APN's info to ril (such as APN name,user,password)

APN got null value from system, then use default user/password to connect(default is dummy/dummy). So if user/password is not dummy/dummy, data connection will not work.

The new ril handled MMS, we can set the correct APNs for MMS receive.
I appreciate the info. I'm not sure how to merge it into the system file, hopefully somebody will come out with a build with the new RIL. (preferrable GB) or I'll just wait until it's committed.
The Following User Says Thank You to vnes1984 For This Useful Post: [ Click to Expand ]
 
highlandsun
Old
#3  
Recognized Developer
Thanks Meter 248
Posts: 794
Join Date: Sep 2009
Location: Los Angeles

 
DONATE TO ME
I believe a simpler approach will be just to re-enable the APN Settings option in Phone Settings menu for CDMA phones. I don't have a CDMA phone to test this with, but something like this patch ought to do the trick:

Code:
diff --git a/res/xml/cdma_options.xml b/res/xml/cdma_options.xml
index 346674c..dfc9223 100644
--- a/res/xml/cdma_options.xml
+++ b/res/xml/cdma_options.xml
@@ -17,6 +17,17 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.phone">
 
+    <PreferenceScreen
+        android:key="button_apn_key"
+        android:title="@string/apn_settings"
+        android:persistent="false">
+
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.settings"
+            android:targetClass="com.android.settings.ApnSettings" />
+
+    </PreferenceScreen>
+
     <com.android.phone.CdmaRoamingListPreference
         android:key="cdma_roaming_mode_key"
         android:title="@string/cdma_system_select_title"
violino:/home/software/xdandroid/packages/apps/Phone>
(I literally just copied and pasted that out of the gsm_umts_options.xml file.)

Enabling this setting should make life easier for packaging, because then we don't need to worry about shipping with correct APN info pre-loaded for every carrier... But someone who can recompile the Phone app and run on CDMA will have to try this out and report back.
T-Mobile G1 / radio 2.22.28.25 / SPL 1.33.0013d / Recovery RA-dream-1.7.0 / FroyoByLazlo-4
T-Mobile TP2 (RHOD210) / radio 4.49.25.57 / WM6.5 / XDAndroid FRX06+Fixes
Verizon Droid4 / 6.16.217.XT894
 
muziling
Old
#4  
Senior Member - OP
Thanks Meter 32
Posts: 274
Join Date: Dec 2010
I must leave home now, I will try tonight, thanks .
EVO3D sprint
 
BoominSVX
Old
#5  
Member
Thanks Meter 11
Posts: 94
Join Date: Jan 2010
I gave it a try with apk manager, but might have done it a little wrong. All I ended up with was a fatal error in MAIN when I clicked the wireless and networks button. Force Close. I'm not sure I should be jumping in this deep yet.
 
highlandsun
Old
(Last edited by highlandsun; 6th April 2011 at 09:24 AM.)
#6  
Recognized Developer
Thanks Meter 248
Posts: 794
Join Date: Sep 2009
Location: Los Angeles

 
DONATE TO ME
Quote:
Originally Posted by BoominSVX View Post
I gave it a try with apk manager, but might have done it a little wrong. All I ended up with was a fatal error in MAIN when I clicked the wireless and networks button. Force Close. I'm not sure I should be jumping in this deep yet.
Yeah, looks like there's more to it than just that first patch. I'm still looking...

OK, since Phone.apk is a system app, it's not straightforward to just build a new one and drop it into place. The apps are cryptographically signed, and you need to have the same key on your build machine as was used to create it originally. I was running FRX06 and I don't have their release keys, so I replaced all of my /system with my own build of the Froyo tree. But even that wasn't enough, because /data/system still had records of the original keys. I found out about that here

http://forum.cyanogenmod.com/topic/3...after-upgrade/

After I did these edits on /data/system/packages.xml I was able to boot with my new system image (without first deleting all of my /data).

So here's the changes I made to the Phone.apk:

First, instead of leaving the APN setting in the GSM-specific options, I moved up to the generic Network Settings instead, so it can be used by both GSM and CDMA:
Code:
diff --git a/res/xml/gsm_umts_options.xml b/res/xml/gsm_umts_options.xml
index afdd0d3..25bc031 100644
--- a/res/xml/gsm_umts_options.xml
+++ b/res/xml/gsm_umts_options.xml
@@ -17,17 +17,6 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.phone">
 
-    <PreferenceScreen
-        android:key="button_apn_key"
-        android:title="@string/apn_settings"
-        android:persistent="false">
-
-        <intent android:action="android.intent.action.MAIN"
-            android:targetPackage="com.android.settings"
-            android:targetClass="com.android.settings.ApnSettings" />
-
-    </PreferenceScreen>
-
     <com.android.phone.Use2GOnlyCheckBoxPreference
         android:key="button_prefer_2g_key"
         android:title="@string/prefer_2g"
diff --git a/res/xml/network_setting.xml b/res/xml/network_setting.xml
index 5d70e67..f296d67 100644
--- a/res/xml/network_setting.xml
+++ b/res/xml/network_setting.xml
@@ -49,6 +49,17 @@
         android:dialogTitle="@string/preferred_network_mode_dialogtitle" />
 
     <PreferenceScreen
+        android:key="button_apn_key"
+        android:title="@string/apn_settings"
+        android:persistent="false">
+
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.settings"
+            android:targetClass="com.android.settings.ApnSettings" />
+
+    </PreferenceScreen>
+
+    <PreferenceScreen
         android:key="gsm_umts_options_key"
         android:title="@string/gsm_umts_options"
         android:persistent="false">
Then I deleted the GSM-specific code that disables this menubutton when the phone is not GSM:
Code:
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
index 48411f6..9fcf6f4 100644
--- a/src/com/android/phone/GsmUmtsOptions.java
+++ b/src/com/android/phone/GsmUmtsOptions.java
@@ -30,11 +30,9 @@ import com.android.internal.telephony.PhoneFactory;
  */
 public class GsmUmtsOptions extends PreferenceActivity {
 
-    private PreferenceScreen mButtonAPNExpand;
     private PreferenceScreen mButtonOperatorSelectionExpand;
     private CheckBoxPreference mButtonPrefer2g;
 
-    private static final String BUTTON_APN_EXPAND_KEY = "button_apn_key";
     private static final String BUTTON_OPERATOR_SELECTION_EXPAND_KEY = "button_carrier_sel_key";
     private static final String BUTTON_PREFER_2G_KEY = "button_prefer_2g_key";
 
@@ -45,12 +43,10 @@ public class GsmUmtsOptions extends PreferenceActivity {
 
         addPreferencesFromResource(R.xml.gsm_umts_options);
         PreferenceScreen prefSet = getPreferenceScreen();
-        mButtonAPNExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_APN_EXPAND_KEY);
         mButtonOperatorSelectionExpand =
                 (PreferenceScreen) prefSet.findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY);
         mButtonPrefer2g = (CheckBoxPreference) prefSet.findPreference(BUTTON_PREFER_2G_KEY);
         if (PhoneFactory.getDefaultPhone().getPhoneType() != Phone.PHONE_TYPE_GSM) {
-            mButtonAPNExpand.setEnabled(false);
             mButtonOperatorSelectionExpand.setEnabled(false);
             mButtonPrefer2g.setEnabled(false);
         }
The resulting phone.apk still works for me. I'm pretty sure it will work for CDMA too, but you either need to build it yourself, or one of the xdandroid dev team will have to give us a patched Phone.apk signed with their release key.
T-Mobile G1 / radio 2.22.28.25 / SPL 1.33.0013d / Recovery RA-dream-1.7.0 / FroyoByLazlo-4
T-Mobile TP2 (RHOD210) / radio 4.49.25.57 / WM6.5 / XDAndroid FRX06+Fixes
Verizon Droid4 / 6.16.217.XT894
The Following User Says Thank You to highlandsun For This Useful Post: [ Click to Expand ]
 
Entropy512
Old
#7  
Elite Recognized Developer
Thanks Meter 21117
Posts: 11,602
Join Date: Aug 2007
Location: Owego, NY

 
DONATE TO ME
Specifically, you'll need to build the whole release yourself using the info at:

http://xdandroid.com/wiki/Getting_the_Source

I don't run CDMA so I can't test this even though I run self-build source builds.
*so much sig updating needed*

My Github profile - Some Android stuff, some AVR stuff

An excellent post on "noobs vs. developers"

A few opinions on kernel development "good practices"

Note: I have chosen not to use XDA's "friends" feature - I will reject all incoming "friend" requests.

Code:
<MikeyMike01> Smali is a spawn of hell
<shoman94> ^^^ +!
Code:
<Entropy512> gotta be careful not to step on each other's work.  :)
<Bumble-Bee> thats true
<jerdog> compeete for donations
 
ryannathans
Old
#8  
Senior Member
Thanks Meter 45
Posts: 284
Join Date: Dec 2009
Location: Perth, Western Australia

 
DONATE TO ME
Quote:
Originally Posted by Entropy512 View Post
Specifically, you'll need to build the whole release yourself using the info at:

http://xdandroid.com/wiki/Getting_the_Source

I don't run CDMA so I can't test this even though I run self-build source builds.
That link is very outdated and I am having problems getting it to work, so far it has been about a month since I started trying to get it working. GingerBread will not compile doing what they say, I am about to try Froyo. Oh and I will be covering GSM only.
Quote:
Originally Posted by arrrghhh
Put on your big boy pants, this is the Internet (that's right, capital I ).
 
arrrghhh
Old
#9  
Retired Forum Moderator
Thanks Meter 2198
Posts: 8,790
Join Date: Feb 2007

 
DONATE TO ME
Quote:
Originally Posted by ryannathans View Post
That link is very outdated and I am having problems getting it to work, so far it has been about a month since I started trying to get it working. GingerBread will not compile doing what they say, I am about to try Froyo. Oh and I will be covering GSM only.
I didn't realize there was a more up-to-date one...?

Those directions worked great for me on Froyo, I haven't tried since gb was released TBH...
 
rpierce99
Old
#10  
Senior Member
Thanks Meter 109
Posts: 194
Join Date: Jan 2009
Quote:
Originally Posted by ryannathans View Post
That link is very outdated and I am having problems getting it to work, so far it has been about a month since I started trying to get it working. GingerBread will not compile doing what they say, I am about to try Froyo. Oh and I will be covering GSM only.
As far as I know the only differences for GB is it requires a 64bit OS and a different version of Java IIRC.
RHOD 300 unlocked on Tmo | GBX0B