How to configure App42api with out extending App42Activity?

0 votes


    Our app main activity already extends an activity. But in your example you've showcased in which is extending App42Activity and then instantiating the service in onCreate method. But we want to implement it with out extending your App42Activity. I've tried instantiating but it fails to register. It throws an error at Utils.registerWithApp42(). Please provide a solution on how to instantiate your service with out extending App42Activity.

My code details below.

<!-- GCM connects to Google Services. -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="" />
    <uses-permission android:name="" /> 
    android:protectionLevel="signature" />
    android:permission="" >
        <action android:name="" />  
        <action android:name="" />  
        <category android:name="com.papp.HomePage" />
<service android:name="com.papp.HomePage.GCMIntentService">
   <meta-data android:name="onMessageOpen"
       android:value="com.papp.HomePage" />
</service> is largely based on the example you've provided.
we've added this additionally.
public App42CallBack app42CallBack = new App42CallBack() {
public void onSuccess(Object arg0) {
App42Log.debug(" ..... Registration Success ....");  
            GCMRegistrar.setRegisteredOnServer(App42API.appContext, true);
public void onException(Exception paramException) {
App42Log.debug(" ..... Registration Failed ....");  
            App42Log.debug("storeDeviceToken :  Exception : on startup " +paramException);
//Method to get registered with App42 Platform  
    public void registerWithApp42(String regId) {  
        App42Log.debug(" Registering on App42 Server ....");  
        App42API.buildPushNotificationService().storeDeviceToken(App42API.getLoggedInUser(), regId, app42CallBack);
And in onCreate function we're instantiating your service like below.
/* Setting up for push notifications. */
   GCMIntentService gcm = new GCMIntentService();


asked Mar 3, 2014 in App42 Cloud API-BaaS by it (10 points)

1 Answer

+1 vote
You dont need to extend it using App42Activity. It will work without it too.
answered Mar 3, 2014 by ajay123 (899 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on