Two Android targets with the same code base installed simultaneously - android

Im trying to build two diffrent Android apps derived from the same code base using a library project.
The apps are using a intent service for various operations, however this seems to fail when I have two apps using the same code base installed simultaneously.
It seems as if only the first version of the app I install works, the second one don't seem to get the service to run.
Does anyone have any experience of this? How could this be solved?
EDIT:
These are the manifests
Base:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codebase"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<supports-screens android:largeScreens="true" android:anyDensity="true" android:resizeable="true" android:smallScreens="true" android:normalScreens="true"></supports-screens>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application android:icon="#drawable/icon_launcher" android:label="CodeBase" android:process="#string/app_name" android:name="com.codebase.activity.Application" android:theme="#android:style/Theme.NoTitleBar" android:debuggable="false">
<activity android:configChanges="orientation" android:name="com.codenase.activity.MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.codebase.service.UpdateService" android:process="#string/app_name">
<intent-filter>
<action
android:name="com.codebase.service.UpdateService" />
</intent-filter>
</service>
</manifest>
Target 1:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" />
<supports-screens android:largeScreens="true" android:anyDensity="true" android:resizeable="true" android:smallScreens="true" android:normalScreens="true"></supports-screens>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application android:icon="#drawable/icon_launcher" android:label="Target One" android:name="com.codebase.activity.Application" android:theme="#android:style/Theme.NoTitleBar">
<activity android:configChanges="orientation" android:name="com.codebase.activity.MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.codebase.service.UpdateService" android:process="#string/app_name">
<intent-filter>
<action
android:name="com.codebase.service.UpdateService" />
</intent-filter>
</service>
</activity>
</application>
</manifest>
Target 2:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trg2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" />
<supports-screens android:largeScreens="true" android:anyDensity="true" android:resizeable="true" android:smallScreens="true" android:normalScreens="true"></supports-screens>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application android:icon="#drawable/icon_launcher" android:label="Target 2" android:name="com.codebase.activity.Application" android:theme="#android:style/Theme.NoTitleBar">
<activity android:configChanges="orientation" android:name="com.codebase.activity.MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.codebase.service.UpdateService">
<intent-filter>
<action
android:name="com.codebase.service.UpdateService" />
</intent-filter>
</service>
</application>
</manifest>

First, there is no need to define intent-filter for the service in AndroidManifest.xml in this situation, the following definition is sufficient if you don't need provide additional access point from outside your app:
<service android:name="com.codebase.service.UpdateService"/>
Then using public Intent (Context packageContext, Class cls) to start service:
Intent intent = new Intent(getBaseContext(), UpdateService.class);
startService(intent);
Second, if you do need provide additional access point from outside your app, don't use the same action name in multiple app, as it will fool Android OS when try to pass the intent to the corresponding service (in case if you use public Intent (String action) to start your service):
Target 1:
<service android:name="com.codebase.service.UpdateService" android:process="#string/app_name">
<intent-filter>
<action android:name="com.codebase.service.UpdateService.TARGET_1" />
</intent-filter>
</service>
Target 2:
<service android:name="com.codebase.service.UpdateService" android:process="#string/app_name">
<intent-filter>
<action android:name="com.codebase.service.UpdateService.TARGET_2" />
</intent-filter>
</service>
Hope this helps.

Ensure you have qualified your services correctly in the manifest.
e.g
if you had:
Main Project package name = com.johan.p1
Library Project package name = com.johan.library
Assuming your service is in the library project, your main project would define the service as:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.johan.p1"
<service android:name="com.johan.library.MyServiceName" />
</manifest>

I have two versions of the same android app based on one code base as you do.
I don't have any problems. Both app have different package names
However, I ensure that both have the same (shared) userId. Maybe that is the trick
http://developer.android.com/guide/topics/manifest/manifest-element.html
(By the way, when I remember right, the userId required to have a dot in between)

Related

Activity restarts after showing Admob Rewarded Video ad

I want to update my Activity UI inside onRewardedVideoAdClosed() if user Rewarded , but unable to update any view of my activity due to activity is destroying when rewarded video ad open,
If I'm doing anything wrong, then what? can anyone let me know? because same issue I'm getting in this SampleCode as well.
Finally, I have fixed the issue,
Just added this property in my activity android:configChanges="orientation|screenSize"
Now my activity looks like
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
A nice sample is here
If you are using Unity this also works!
You need to edit the AndroidManifest.xml template that can be found in:
OSX: ~/Applications/Unity/PlaybackEngines/AndroidPlayer/Apk/AndroidManifest.xml
Windows: installation\Editor\Data\PlaybackEngines\androidplayer
*See more details in this Unity Question
Here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<application
android:theme="#style/UnityThemeSelector"
android:icon="#drawable/app_icon"
android:label="#string/app_name">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
As you can see I added android:configChanges="orientation|screenSize" to the activity.
Please note you could instead copy that AndroidManifest.xml file into your Assets/Plugins/Android folder as a per project solution, otherwise this will affect all your Unity projects (if I understand correctly).

Soomla GooglePlayIabService

Hi I have used the older version of soomla plugin in my android app and it was working fine, but when i try to integrate into the latest version(core version : 1.0, StoreVersion : 1.7.3) available this error pops up.
SOOMLA GooglePlayIabService
(launchPurchaseFlow) Error purchasing item calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
SOOMLA SoomlaStore
ERROR : SoomlaStore failure(launchPurchaseFlow) Error purchasing item Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. is this really what you want?
When i created an empty project and tried the plugin i could make the purchase successfully. Same is not happening for the project i want it to work with. Also using Facebook unity plugin. Unity version is 4.5.3.
11-24 16:38:39.497: E/SOOMLA GooglePlayIabService(12139): (launchPurchaseFlow) Error purchasing item Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
11-24 16:38:39.497: E/SOOMLA SoomlaStore(12139): ERROR: SoomlaStore failure: (launchPurchaseFlow) Error purchasing item Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
AndroidManifest file is below.
![<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_TASKS" />
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<uses-sdk android:targetSdkVersion="21" android:minSdkVersion="9" />
<application android:icon="#drawable/app_icon" android:label="#string/app_name" android:debuggable="true" android:name="com.soomla.SoomlaApp">
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
<activity android:name="com.unity3d.player.VideoPlayer" android:label="#string/app_name" android:screenOrientation="behind" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.soomla.store.billing.google.GooglePlayIabService$IabActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<meta-data android:name="billing.service" android:value="google.GooglePlayIabService" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.LoginActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>
<activity android:name="com.TeenPatti.RoyalIndianPoker.MainActivity" android:label="#string/app_name">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 1499084616994189" />
</application>
</manifest>][1]
Here is the screenshot for the logcat error
There seemed to be an issue with AndroidStoreGooglePlay.jar. Changing it to the latest commit fixed the issue for me latest commit. Hope it might help others too.

No launcher activity found.! The launch will only sync the application package on the device.!

I am facing the problem plzzz help me out. Here is my manifest.xml file.
Plz help me out.......your help is highly appreciated....
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hello.myandroidnew"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myandroidnew.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAINACTIVITY" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".second"/>
</application>
</manifest>
Change your intent filter to the following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The difference is the action. It must be android.intent.action.MAIN in order to be listed in the launcher.
You have to set the action name properly so that android know that it is the main activity. Change
<action android:name="android.intent.action.MAINACTIVITY" />
to
<action android:name="android.intent.action.MAIN" />
update:-
You specify name of the class in
<activity
android:name="com.example.myandroidnew.MainActivity"
Docs of "android.intent.action.MAIN" specifies :-
public static final String ACTION_MAIN
Added in API level 1
Activity Action: Start as a main entry point, does not expect to receive data.
Input: nothing
Output: nothing
Constant Value: "android.intent.action.MAIN"
Thus you can see that action.MAIN tells android that it is the main entry point i.e. the default activity that is to be shown when the app starts.

Apportable conversion VerdeActivity error

Hi all and thanks in advance,
i'm new with apportable and i'm trying to port my iOS app. I can build the app with no error but when i try to "load"(apportable load) or "debug" (apportable debug) on device or emulatior i recieve this message ".VerdeActivity class does not exists".
i have read this question too but i'm having the same problem also after the modifications.
Can anyone help me?
Here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Lallo"
android:sharedUserId="Lallo"
android:installLocation="auto"
android:versionCode="1373630001"
android:versionName="1.1.1">
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:resizeable="true" android:normalScreens="true" android:largeScreens="true" android:smallScreens="false"/>
<application android:label="#string/app_name"
android:name="com.apportable.app.VerdeApplication"
android:hasCode="true"
android:icon="#drawable/icon"
android:theme="#style/FullScreenActivity"
android:debuggable="true"
android:largeHeap="false"
android:hardwareAccelerated="true">
<meta-data android:name="android.app.libs" android:value="v cxx System objc ffi pthread_workqueue dispatch Foundation BridgeKit OpenAL verde" />
<meta-data android:name="android.app.lib_name" android:value="verde" />
<meta-data android:name="android.app_name" android:value="Lallo" />
<meta-data android:name="apportable.splash_screen_type" android:value="letterbox" />
<meta-data android:name="apportable.orientation" android:value="landscape" />
<meta-data android:name="apportable.opengles2" android:value="true" />
<meta-data android:name="apportable.opengles.fast_color" android:value="true" />
<activity android:name="com.apportable.activity.VerdeActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustPan"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fb361458087289348"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:enabled="true" android:name="com.apportable.activity.GdbServerService"
android:label="#string/app_name" android:icon="#drawable/icon">
<intent-filter >
<action android:name="Lallo.GdbServerService" />
</intent-filter>
</service>
</application>
</manifest>
Here is the complete error message
3052 KB/s (33870847 bytes in 10.834s)
pkg: /data/local/tmp/Lallo-debug.apk
Failure [INSTALL_FAILED_INVALID_APK]
Starting: Intent { cmp=Lallo/com.apportable.activity.VerdeActivity (has extras) }
Error type 3
Error: Activity class {Lallo/com.apportable.activity.VerdeActivity} does not exist.
your package name is just "Lallo". You need a package name with dots in there. Usually a fully qualified reverse DNS name of your company with the package name.
For example:
com.apportable.Spin
You can change this in your .approj/configuration.json file.
Hope that helps.
An alterative reason for this error:
When running apportable for the first time, it asks which version of OpenGS ES (ES1 or ES2).
If you answer this wrong then you will get this error.
In my case I didn't realise the game I was working on still had the old version of cocos2d in it - uses ES1.
Hope this helps somebody else. I spent most of a day on this issue thinking there was an issue with my phone...

Friends android devices cannot install my android app, I cant even do it for my own

I recently uploaded my android app to the marketplace https://market.android.com/details?id=com.DGNT yet my friends cannot install it on their devices (says their phone is incompatible). The site even says my own phone is incompatible for my own app, even though i have compiled it through eclipse and sucessfully installed the apk on my phone and tablet. (telus LGE LG-p500h and asus transformer tf101)
Is there something wrong with my app or should i just wait a little longer to see what happens? Ive been told my manifest could have something to do with it so here is what i got.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.DGNT"
android:versionCode="2"
android:versionName="1.01">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="com.DGNT.MainScreenActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.DGNT.QuickStartActivity"
android:label="Quick Start"
android:screenOrientation="portrait">
</activity>
<activity android:name="com.DGNT.ManagePlayersActivity"
android:label="Manage Players">
</activity>
<activity android:name="com.DGNT.PlayerListActivity"
android:label="Start From Player List"
android:screenOrientation="portrait">
</activity>
<activity android:name="com.DGNT.EditPlayersActivity"
android:label="Edit Players">
</activity>
<activity android:name="com.DGNT.CreditsActivity"
android:label="Credits">
</activity>
<activity android:name="com.DGNT.HelpActivity"
android:label="Help">
</activity>
<activity android:name=".AboutActivity"
android:label="About">
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
You should definitely have a <supports-screens /> element in your manifest to list the screen sizes your app is compatible with. Try adding this just after your opening manifest tag:
<supports-screens
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
That should open up the app for any type of screen. Obviously I'm assuming here that you want it available for any screen size, so tweak as needed! More details here.
Hope that solves it for you

Categories

Resources