Skip to content

Instantly share code, notes, and snippets.

View mizutori's full-sized avatar

Takamitsu Mizutori mizutori

View GitHub Profile
<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=“myapp”/>
</intent-filter>
Intent intent = getIntent();
Uri uri = intent.getData();
if(uri != null){
final String source = intent.getData().getQueryParameter(“source”);
final String locale = intent.getData().getQueryParameter(“locale”);
Log.d("intent params", “source=" + source + “,locale=" + locale);
}
Bundle parametros = getIntent().getExtras();
if (extras != null){
String source = extras.getString(“source);
Integer locale = extras.getInt(“locale”);
}
@mizutori
mizutori / gist:1948f4f2ae21dd5bd842
Created October 21, 2014 07:45
Example: Call MyFramework's public method
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
MyFramework.start()
return true
}
@mizutori
mizutori / gist:31157fd07b54e2d78f9e
Created October 21, 2014 07:56
Example: MyFramework implementation
import UIKit
public class MyFramework: NSObject {
public class func start(){
println("MyFramework starting...")
}
}
@mizutori
mizutori / gist:6642b0c921b371fc125f
Created October 22, 2014 14:30
Example: MyFramework universal target build script
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
FRAMEWORK_NAME=MyFramework
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# 1. Copy the iphone device's framework structure to the universal folder
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
# 2. Copy the Modules content from simulator's framework to universal folder
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'SomeApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for SomeApp
pod 'InAppTranslation'
import UIKit
import InAppTranslation
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
override class func initialize(){
InAppTranslation.start("token", async: false)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
InAppTranslation.start("token", async: true)
return true
}
InAppTranslation.showFeedbackAlert()