how do i fix the device rotation in a titanium app across all mobile platforms? Any references to official doco would be super useful!
so i don't want to so much "disable rotation" as "only ever let the app run in a particular orientation" (which in my case is portrait mode)
cheers
The official web site is down at the moment, but you would want to look up 'orientation modes'. The following code locks my windows to only portrait mode in my app.
loginWin = Ti.UI.createWindow({
orientationModes: [Ti.UI.PORTRAIT]
});
// Required to fix Android still?
loginWin.orientationModes = [Ti.UI.PORTRAIT];
Full-ish answer - this will STILL allow an orientation change when the loading screen starts up. Titanium seems to be holding this one close to their chest, but here goes:
in the tiap.xml file, you need to make changes to the first indentation-level android element
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiTranslucentActivity"
android:screenOrientation="portrait" android:theme="#android:style/Theme.Translucent"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiModalActivity"
android:screenOrientation="portrait" android:theme="#android:style/Theme.Translucent"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="ti.modules.titanium.ui.TiTabActivity" android:screenOrientation="portrait"/>
<activity
android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:screenOrientation="portrait"/>
</application>
</manifest>
</android>
the above code can be dropped in (remove the existing android element first, of course!) and should work.
The trick here is the use of
android:screenOrientation="portrait"
which sets the orientation to portrait. The other option is 'landscape', of course. I think if you leve this out the the default behaviour is to allow the orientation to switch around.
iOS is, of course, easier.
In the same tiapp.xml file you need
<ios>
<plist>
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
</ios>
this will replace whatever is in your current ios element, and is at the same level as the android element
ie
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
...
<ios>
...
</ios>
<android>
...
</android>
</ti:app>
I still don't know how to stop android (and possibly ios) from re-orienting the splash screen, if anybody knows how let me in on the secret!!!
Related
React native application. Despite having entered in the manifest android:exported="true" i still have this problem in the build phase. It almost seems that some installed plugins did not insert it.
I read in some posts that proposed as a temporary solution to downgrade to version 30 of the android SDK, but i cannot because with that version it does not allow me to compile.
React Native 0.68
Android SDK version 33
Android Gradle Plugin version 7.3.0
From Merged Manifest
Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. mobile_app.app debug manifest, line 26 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. mobile_app.app debug manifest, line 33
Based on the response from Aleja Duque-Torres, here's a temporary solution by adding the following code segment to your AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...your package name"
xmlns:tools="http://schemas.android.com/tools"> <!-- ADD THIS LINE -->
<!-- Other Content -->
<application
.../>
<!-- ADD STARTS HERE -->
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="false"
tools:replace="android:exported"/>
<!-- ADD ENDS HERE -->
</application>
</manifest>
Then do a build folder clean and run the project again. Hope this helps!
P.s. my guess is that this problem is due to some dependency package getting messed up. If someone else has any insight please feel free to shed some light on it!
solution:
In Git-bash run: * ./gradlew assembleDebug --stacktrace --info | tee my-logs.txt
Search "InstrumentationActivityInvoker"
Open file and add android:exported="true" on activity
Same issue, But I can't know the reason for it. It happens when I have updated macos, Do you have any information?
I am using Ti.Platform.canOpenURL() to open another app which worked fine before iOS 10.
But it doesn't work on iOS 10 and later.
How to solve this?
You use Ti.Platform.canOpenURL('<my-url>') to check for the URL. To open the URL, you need to use Ti.Platform.openURL('<my-url>') instead.
With some of the new security features of iOS9, SDK 5.1.2's canOpenUrl might fail without adding in the proper properties in the info.plist file.
Therefore, you need to add the following key into the tiapp.xml file:
<ios>
<plist>
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>[Your Project Name]</string>
<string>[Your Second Project Name (if any)]</string>
</array>
</dict>
</plist>
</ios>
Hope this helps.
Cheers.
I'm trying to set up automatic updates on my Safari extension and it doesn't seem to be working. Here is what I have tried so far.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Extension Updates</key>
<array>
<dict>
<key>CFBundleIdentifier</key>
<string>com.COMPANY_NAME.safari.EXTENSION_NAME</string>
<key>Developer Identifier</key>
<string>MY_IDENTIFIER</string>
<key>CFBundleVersion</key>
<string>4</string>
<key>CFBundleShortVersionString</key>
<string>4</string>
<key>URL</key>
<string>PATH_TO_EXTENSION_DOWNLOAD</string>
</dict>
</array>
</dict>
</plist>
From my understanding whenever someone who has downloaded the extension opens Safari with my extension installed it will ping the "Update Manifest URL" set in the extension builder. If the versions do not match the extension at the download URL then an update will be made.
The .plist file is on my server and the extension is being served from the server with the "Update Manifest URL" set correctly. I can download the extension from my website but when I upload a new extension version and update the plist file I'm not getting prompted to update my extension in Safari > preferences > extensions.
Is there anything potentially missing in what I've been doing?
Try setting the date on your computer a day or to into the future. I think Safari only checks for updates once a day. Or did you already solve this?
I would try hitting your 'Update Manifest' URL directly and ensure that the file it's calling is indeed a greater version than the current extension you have. If that checks out fine then your current version of the extension might not have an update manifest URL set so your update file isn't being called at all!
In this case you need to either figure out what update manifest URL the current version is pointing at and upload your update.plist file there and continuously do that upon every release incase users from v1.0 (with update issues) are coming back when v3.0 is out using the new update url they need a way to break their dependency on that old update manifest url...or require that new users install your updated version directly from the server with the proper update manifest URL field set as well as the update.plist you posted above.
As a test I would install the latest version of the extension from your server, turn off auto update in safari preferences so you'll be notified if there's a new version, then bump the versions to 4.0.1 or something minor and upload the new files to the server. Then restart safari and see if anything triggers inside the safari extension preferences.
I have verified the communication to update server with Wireshark. Seems that Safari would check updates.plist (the one specified in the extension Info.plist as
<key>Update Manifest URL</key>
<string>URL/updates.plist</string>
) anytime you visit Preferences -> Extensions -> Updates. If the server responds with 304 Not Modified, Safari does no further action. If the plist contains a newer version of the extension (and it's the only version in the plist), Safari downloads and updates the extension.
I am sorry for posting so many questions, but getting this to work has been incredibly painful, even tho Testflight makes it much easier
Invalid IPA error: The APS environment in your embedded.mobileprovision and your binary don't match
I figure this has got to do with my Apple Push Notifications. I am using my distribution profile across all my settings. My app has been configured to both development and production.
What could the causes of this error be?
As a side note, I have been working on this for the entire day, and I get stuck at one thing after the other, esp involving static libraries and xcode4. Am I really bad at this, or does Apple really make it so hard?
I think it was an xcode bug. Here's how i solved it, and maybe it can be useful for some users in the future. Including my problem solving steps for reference:
i changed the entitlement file to aps-environment = production. No go, still different between the 2 files.
i changed ALL my settings (debug/not) to the distribution profile, just to be sure
I built it again, and checked out the embedded.mob and binary as you suggested
No go again.
I went nuclear - deleted all my profiles, downloaded only the distribution build i needed
here is when it became interesting - i could not build it on debug (expected), but i was having the same problem of "profile not found" even when i was in ad hoc archiving mode. Surely that means that there remains a reference to the developer mode even when i was trying to archive it (given that i have already changed ALL my settings and deleted all my other profiles)
So i digged up project.pbxproj, and found the offending line that was still trying to access my development profile in ad hoc build. I changed it manually, and bingo, things worked as per expected
End of the day, i am surprised why this would happen. It seems like an xcode 4 bug. Normally it is my fault when these things happen, but this seems arcane enough (plus i had so much trouble with xcode 4 for a few other things).
Solved with help from the amazing Testflight team!
http://support.testflightapp.com/discussions/tools/17-invalid-ipa-the-aps-environment-in-your-embeddedmobileprovision-and-your-binary-dont-match
Also, particularly if the target you're archiving was based on another target, double check that your target's "Archive" Scheme is based on the correct Build Configuration of Build Settings.
In Xcode 4.2 next to the run menu, click on -> Edit
Scheme
Click on the 'Archive' button in the left drawer
Look at 'Build Configuration
For Testflight, I replicate my Release Build Configuration, and rename it 'Ad Hoc' for just this purpose, specifying my Ad Hoc provisioning profile and whatever else needs to be in there. If you've gotten this far, I presume you've already done that, but for posterity, I figured I'd mention it.
I ran across this error before as well, so follow these instructions for this to work:
Create a provisioning profile for your app and add the devices to it of the people who should test it.
Build your application using that provisioning profile you just created and export it as an *ipa.
Upload it to TestFlight and select the devices that you want to test the app on.
Many people miss step 2, (so did I) and that's essential for it to work. So give it a try! :)
Replying this question, in case someone bumps onto this while uploading an air mobile app.
Make SURE you check the Entitlements element in your app.xml.
<iPhone>
<InfoAdditions>
<![CDATA[
<key>UIDeviceFamily</key>
<array>
<!-- iPhone and iPod touch devices -->
<string>1</string>
<!-- iPad devices -->
<string>2</string>
</array>
]]>
</InfoAdditions>
<!-- This part below.. -->
<Entitlements>
<![CDATA[
]]>
</Entitlements>
My Entitlements looked like this back when I got the error:
<Entitlements>
<![CDATA[
<key>application-identifier</key>
<string>QFY9MVY9K8.com.somethingHere.anAppName</string>
<key>aps-environment</key>
<string>development</string>
]]>
</Entitlements>
This is how it looks now:
<Entitlements>
<![CDATA[
<key>get-task-allow</key>
<false/>
]]>
</Entitlements>
This error was caused because
I used a DIFFERENT ID in the <key>application-identifier</key> than the one in my provisioning profile.
I used development key instead of production in the <key>aps-environment</key> part.
I want to be able to multitask in Matt Gallagher's AudioStream iphone application which can be found over here http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html I tried uibackground by adding to info.plist but it isn't working any ideas on how to make it work? I did read the apple documentation but I have failed to find anything. any code would be appritated
thanks,
add this to your info.plist
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
<string>location</string>
</array>