I am using SKMaps (Skobbler) to develop an Android app in Eclipse.
I have an application which displays a map, has 2 buttons, can find routes to a point on the screen I tap on and initiate the navigation the SDK provides.
My problem is when I change the orientation of the device the app just closes. It does not give me any error message so I cannot identify the source of the issue.
The demo application provided handles the orientation of the device easily. I noticed that when I turn it around in the LogCat a message is displayed saying:
05-09 12:22:37.560: D/SKMaps(7866): MapRenderer----onSurfaceChanged width = 720 height= 1134
My application simply closes with the last message being:
05-09 12:22:37.745: D/SKMaps(7866): SKCurrentPositionProvider----stopped receiving position updates
I cannot find where in the demo application the code to handle orientation is. Does anyone have any idea where I could be going wrong.
ps. I have declared in my Manifesto my activity as:
<activity
android:name="com.aatana.mymapproject.MyActivity"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In the demo project, the MapActivity has overriden its onDestroy:
#Override
protected void onDestroy() {
super.onDestroy();
currentPositionProvider.stopLocationUpdates();
SKMaps.getInstance().destroySKMaps();
android.os.Process.killProcess(android.os.Process.myPid());
}
You need to delete the line that kills the process:
android.os.Process.killProcess(android.os.Process.myPid());
Related
I have an app I built, deployed and is being tested with Google Developer Tester Option. My app(s) i have been developing has a wierd issue I can not put my finger on.
The App is a simple Note Taking App. So there is not a lot of code. I done my main activity only has about 60 lines of code. Everything else is composed of classes.
When I test my app on my cellphone. There is a time delay of 5 seconds that a white screen shows while launching. Then it goes to the app.
I would usually put a splash screen. And its seamless in loading. Without the splash screen with normal code it shows the white screen for 5 seconds.
My question is, am I doing something or wrong or is this something with the transition of .apk to .aab when packaging?
I have read articles of people saying its a bug withing Android itself. I have no warnings or errors within the app.
This has me puzzled and any advice would be helpful.
Here is a screenshot of the start up process.
Then this happens for 5 seconds then the main app shows
Any help is appreciated.
Ok after some test coding I finally solved the issue. To have the White Screen not appear you can create a splash screen or just a theme.
Theme should be set as follows
<style name="Theme.SplashScreen" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowDisablePreview">true</item>
</style>
Then in your SplashScreen.kt you can add the following
val handler = Handler(Looper.getMainLooper())
handler.postDelayed({
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
}, 2000)
Then in your Manifest you need add the following:
<activity
android:name=".SplashScreen"
android:exported="true"
android:theme="#style/Theme.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
</activity>
This cuts the launch time with the Splash Screen to whatever your delay is set at.
Your application can't launch instantly, the time it takes to launch an application depends on several hardware factors. So the launch time is different from one smartphone to another
https://developer.android.com/topic/performance/vitals/launch-time
i am using one app, for example chrome with some confidential information and i am switching it to background & i am trying to kill the app.
i uploaded the example image when trying to kill the app. even the session the expired it won't close the information in the killing stage when app comes foreground then only it closes the information. i want the info should be closed or hided when it goes background (In killing stage).
i searched in google i am not getting anything related to this and i don't know whether my search phrase is correct. can anyone pleas help me.
I think ur asking this:
Just add this in manifest file:
android:excludeFromRecents="true"
Example:
<activity
android:name=".MainActivity"
android:excludeFromRecents="true"
android:taskAffinity=".OnInviteActivity"
android:noHistory="true"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
then your app will not show in background or recent app or in menu like that
UPDATE:
for ur app name only u need to add this in Main Activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
I am developing an Android app. At first everything was going smooth, but after some time, the app started to disappear (more accurate not appear) after a successful installation on a real android device. After installing it, the open button is deactivated (I can only click done) and I cannot find it on the menu, but checking with root uninstaller, it appears that the app is really installed.
On the emulator, it installs ok but the installed app doesn't show the correct icon, while prior to this error it wasn't doing so.
I forced the removal of some permissions # Manifest, because I only need (and the app was running with it only) internet access (web view). I tried removing that but it is just the same.
This change came when I introduced a splash screen which loads after the webview if it's the first time ==> MainActivity: If it's first time { setContentView with splash layout. Eventually, after the 3 slides, button onClick which changes to webview activity (class)(1) } else { setContentView with webview layout(2) }
(1) and (2) perform the same tasks, (2) inside a method in MainActivity and (1) in the onCreate of the WebView class.
I know for a fact that it is a better way to do this. Any help on how to do perform this task in a better way appreciated, and also how to get rid of the "installed but invisible" thing.
In your manifest ensure that your intent filter has the category <category android:name="android.intent.category.LAUNCHER" />
<activity
android:name=".activity.SpashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I am experiencing a little pain on Android. I have two activities, one is a Splash Screen, launched when you click on the app icon, and an other one which can wake up when a specific event occurred (a NFC event, but it is not the problem).
There is the declaration in the manifest :
<activity android:label="#string/general.appName" android:name=".activity.SplashActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:excludeFromRecents="true" android:label="#string/general.appName" android:name=".EventReceiver" android:noHistory="true" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.nfc.action.TRANSACTION_DETECTED">
</action>
<category android:name="android.intent.category.DEFAULT">
</category>
<data android:host="secure" android:path="/aXXXXX" android:port="0" android:scheme="nfc"/>
</intent-filter>
</activity>
All works fine, it means that the EventReceiver is launched when it received a specific event, the Splash Screen is functional etc...
But, when the application is launched by an event, so it is the EventReceiver which is launched first. If I pause the app by clicking on the home button of the phone, and by long clicking on it again, it makes appear the multitask table, with all the recent opened apps. There, is I click on my application, it resumed the application on the EventReceiver, just like if an event had occurred. So do you know a way to resume an application on one selected activity only (in my case the SplashScreen).
Or do you know a way to recognize that the application was resumed by a multitask function ? (I could open the good activity at the onCreate of my EventReceiver too if I get this information).
For the moment, the only solution I found is to put a android:excludeFromRecents="true" flag on my EventReceiver activity. This will result that the application will not appear in the multitask table if the application was launched by an event. But this is a little bit tricky and I do not like that very much.
Do you have any ideas ?
Thank you very much beforehand for your answers ! (and sorry for my scholar English ^^)
If you really have to detect when the application is lauched from the "recents" you can use intent flags.
if (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) {
// Lauched from recent apps.
}
Do NOT use a splash screen. It only slows down your app experience and has no value what so ever.
In addition... Android apps are a lose set of activities... There is no concrete entry point that would need a splash screen.
That said... the app switcher returns you to the previously active activity. In your case the .EventReceiver. You could change your structure by using a second activity that shows your ui so that the EventReceiver lets you forward to that.
Correct me if i am mistaken... But can't you intercept the nfc event with an receiver? From there you should open your ui activity.
my android application crashes and shows force close when i tilt the mobile phone. is there any suggestions that i can remove such problem? By the way i am developing a LBS application which uses the google maps (MapView).
I have a splash screen and then shown a ListActivity as below :
<activity android:name=".Splash" 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=".Home" android:label="#string/app_name" android:configChanges="orientation" android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="com.nepways.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
what is wrong with my declaration, the splash screen loads and list activity is also whown correctly but when i change the orientation the application is closed. Please help me.
When you change your orientation the activity is restarted
look at the logcat to see what exception causes your application to FC
You can change your manifest to disable activity restarting by customizing configChanges, if you stil have the problem override onConfigurationChanged() to fix what is generating this exception (like initialize something that may cause a nullpointer)
First of all as it is said the app is restarting (or as it is said in reference redrawing) each time when you change orientation.
To block it in your manifest file in activity you have to put this line which describes the activity orientation:
<activity android:name=".Splash"
android:label="#string/app_name"
android:screenOrientation="portrait">...
And about this buttons, or keymaps. Telling the truth Ive got thise warnings sometimes but it doesnt change anything in my app. So first change the orientation settings and then it should work correct.
If you want use other screen orientation remember to check here:
http://developer.android.com/guide/topics/manifest/activity-element.html
If you want to avoid restarting your activity on orientation change, you can put this in the activity in the manifest file:
android:configChanges="orientation"
Otherwise, we will need to see more code, and a stacktrace.