The app i am developing should be displayed only in landscape mode.
In my app descriptor i have
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
On iOS devices app is launched in landscape mode and everything works as expected.
But when i tried to deploy on my android device ( Samsung galaxy S3 ), the app is launched in portrait mode.
When I modify the descriptor file to read :
<aspectRatio>landscape</aspectRatio>
<autoOrients>true</autoOrients>
then the app will be changing orientation.
While debugging i found out that the apps orientation when starting is stage.orientation == "default"
Also i have added android:screenOrientation="landscape" to android specific configurations in my app.xml (the app descriptor file):
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
<application android:enabled="true">
<activity android:excludeFromRecents="false" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
]]>
</manifestAdditions>
<!--Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
<!--<colorDepth></colorDepth>-->
</android>
Is this a known issue? What could be the cause of this?
EDIT:
I ended up using stage.setAspectRatio( StageAspectRatio.LANDSCAPE ); in my main class. It will work even with devices that have default orientation other than PORTRAIT
I had similar problems with orientation. As i needed to restrict orientation change only for certain devices i solved it by setting values at runtime (before app has fully initialised).
In main application tag, listen for preinitialize event:
<s:Application ...
preinitialize="preinit()">
And set orientation values in listener:
private function preinit():void
{
systemManager.stage.setOrientation(StageOrientation.ROTATED_LEFT);
systemManager.stage.autoOrients = false;
}
Or try StageOrientation.ROTATED_RIGHT instead.
Edit: As Josh commented, this will only work for devices with portrait as the default (ie: your Samsung S3).
Related
I have an Android mobile app and now I'm trying to run it on Android TV emulator, but it doesn't respond to screen orientation, it is always in portrait mode even though I handled it in code (it0s working both on mobile and tablet).. This is my AndroidManifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="------">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.VIBRATE" />
<permission android:name="android.permission.REBOOT" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name="-----"
android:allowBackup="true"
android:icon="#drawable/ic_launcher_2"
android:label="#string/app_nameMain"
android:launchMode="singleTask"
android:theme="#style/AppTheme"
tools:replace="android:label">
<activity
android:name=".activities.LauncherActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:theme="#style/App.Theme.Translucent"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.LogInActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".activities.BrowserManagerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="#style/MyHomeCustomTheme"
android:windowSoftInputMode="adjustPan" />
</application>
I also tried adding this line of code but it's not helping:
<uses-feature
android:name="android.hardware.screen.portrait"
android:required="false" />
Did you have similar experience or do you have any ideas what's the problem here?
I think it is not about your application orientation configurations. Many Android-tv producers force the orientation as landscape. If you have access, you may check system properties and find about x.forceorientation:landscape and change it.
Some producers have also put a settings menu option such as System Settings > Display > Rotate.
Another way, this application can work on some devices
I had the same problem but with a real TV device - the system ignored rotation at all (everything worked fine on tablets and phones).
I found solution for my case but it can be inappropriate for you.
So, the short answer is "impossible" the long answer goes here:
Firmware for TV devices often tweaked by their manufacturers, in my case it was /system/framework/services.jar
that contained services\com\android\server\wm\WindowManagerService.java
in which the following code handled the rotation case:
if ("box".equals(SystemProperties.get("ro.target.product", "tablet"))) {
rotation = 0;
}
of course the /system/build.prop has setting ro.target.product=box, when I tried to patch this file (I had root and possibility to reflash firmware) the system went into the kind of boot loop. The parameter ro.target.product was used several times inside system applications so I think that final firmware in my case lacks some additional code to handle other target modes. Because of this I was forced to patch classes.dex directly in order to turn this checking off.
Another set of options that controls rotation are persist.demo.hdmirotates and persist.demo.hdmirotation, by default they were turned off. When I added them via the command line:
setprop persist.demo.hdmirotates true
setprop persist.demo.hdmirotation landscape
I got desired behavior: my application chooses necessary orientation and it works! In my case the rotation of TV depends upon cabling requirements, i.e. the relative position of TV and its corresponding socket outlet on the wall.
So, no free lunch :-( each device should be handled separately.
I have followed all steps mentioned in the porting guide for V1.
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<meta-data
android:name="com.here.android.maps.appid"
android:value="id here" />
<meta-data
android:name="com.here.android.maps.apptoken"
android:value="token here" />
<uses-library
android:name="com.google.android.maps"
android:required="false" />
<uses-library
android:name="com.here.android"
android:required="false" />
<activity
android:name=".ui.maps.HereLocationsActivity"
android:launchMode="singleTop"
android:hardwareAccelerated="true"
android:theme="#android:style/Theme.Holo"
android:screenOrientation="portrait" >
</activity>
I have added hardwareAcceleration to application tag as well.
It shows location markers properly without map tiles.
What could be the issuw. I am testing on a Nokia X device without SD card.
Any help would be appreciated.
the minSdkVersion should be also changed to be 11, you do need to set the Id & token to values reserved for you
As well as do add following permissions as well:
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.ACCESS_WIFI_STATE
Also do try zooming out, could indeed be that you are located in a area which is shown in white and having full zoom there..
Basically it should be black if the initialization fails, and it should be blue if there is no tiles (or you are at sea), white background thus would indeed be inddicating something else going wrong.
Do also make sure you have enabled location, and have working mobile internet. Would also suggest opening HERE maps app, and downlaoding the maps tiles for the same location used in the app, thus you could see that how it is supposed to look like.
I have downloaded a Geofence Sample Application form here but it is not working .I have replaced actions in GeofenceUtils class by putting app package name e.g com.example.android.geofence.ACTION_CONNECTION_ERROR is replaced by com.geofencesample.ACTION_CONNECTION_ERROR , here com.geofencesample is my app package name .I have put all the possible permissions regarding Location in manifest file , here is my manifest file .
MANIFEST FILE :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geofencesample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<!--
Requests address-level location access, which is usually
necessary for geofencing
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/title_activity_geofence"
android:theme="#style/AppTheme" >
<activity
android:name="com.geofencesample.MainActivity"
android:label="#string/title_activity_geofence" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!--
This activity should be linked to the app's Launcher icon
-->
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.geofencesample.ReceiveTransitionsIntentService"
android:exported="true" >
</service>
</application>
</manifest>
I am passing lattitude , logitude and radius(10m) of geofence through UI , After clicking on "Register geofence" button I am entering and exiting from geofence but nothing happens . I am not getting any notification or any vibrate alert (I have added it in MainActivity$GeofenceSampleReceiver.handleGeofenceTransition) . Which suitable fix should I do .
Any help will be appreciated .
I have tested it using proper radius and app package name .Now App is working ,but in some cases it gives false entry notification . I am using Mock Locations provider app so that I can test it by keeping himself at a place . Still I am not getting proper notification .
I have an android application which has a provision to controls calls ie, allow or block specific incoming & outgoing phone calls.Here is part of manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxxx.xxxxxx.xxxxxxx"
android:installLocation="internalOnly"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
</activities>
</services>
<receiver android:name="xxxx.xxxx.ReceiverOutGoingCall" >
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
<receiver android:name="xxxx.xxxx.ReceiverIncomingCall" >
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
</application>
</manifest>
This application does not show for some devices in Google play.After a long time search I understood that it is due to <uses-feature> hardware requirements. No i want to remove the required hardware features for phone calls from manifest and check them from code.
Some tablets which does not have a Phone Call functionality does not show my application.So i want to make my application available to these tablets which lacks the required hardware.How can i achieve this?
Thanks in Advance
Some permissions automatically impy feature requirements.
This is what the API Guides says:
"For any of the permissions below, you can disable filtering based on the implied feature by explicitly declaring the implied feature explicitly, in a element, with an android:required="false" attribute."
Your permissions impliy the features android.hardware.wifi, android.hardware.location.network, android.hardware.location.gps, android.hardware.location and android.hardware.telephony.
You set only two of them to android:required="false". So you might try to set the other permissions to not required, too.
Unfortunately, there isn't a way to add permissions after the application is installed. Perhaps you can release 2 APKs. One for mobile devices and one for tablets.
Try this code to check if phone functionality is available :
public static boolean isTablet(Context context) {
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
return manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE;
}
I'm building an Android app with Adobe Air 3.6 and Flash CS 6.
Is it possible to receive content from other apps, e.g. a link from the browser?
I couldn't find a working example anywhere yet.
You can add all the intents you need in the proper section of your app descriptor. Look for the android-related section:
...
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
<application android:enabled="true">
<activity android:excludeFromRecents="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- ADD INTENTS HERE -->
</activity>
</application>
</manifest>
]]>
</manifestAdditions>
<!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
<!-- <colorDepth></colorDepth> -->
</android>
...
Please note this is only half of the story. In order to properly consume those intents you should handle them in your code, something like this:
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,onInvoke);
...
function onInvoke(event:InvokeEvent):void
{
/* handle your intent here */
}
Please refer to official docs here.